﻿@inject LayoutDataServices data

@{
    var cateList = data.getCategoryListOther() ?? new List<article_category>();
}

@if (cateList.Count > 0)
{
    <div class="container-fluid" style="height:370px;overflow-y:hidden;">
        <div id="carousel-cate-list" class="carousel slide" data-ride="carousel">
            @*分类名称*@
            <ol class="carousel-indicators">
                @for (int i = 0; i < cateList.Count; i++)
                {
                    <li data-target="#carousel-cate-list" data-slide-to="@i" @(i == 0 ? "class='active'" : string.Empty)></li>
                }
            </ol>

            @*图片*@
            <div class="carousel-inner" role="listbox">
                @for (int i = 0; i < cateList.Count; i++)
                {
                    var href = Url.Action("list", "article", new { id = cateList[i].id });
                    <div class="item @(i==0?"active":string.Empty)" onclick="javascript: window.open('@href','_blank')">
                        <img src="@cateList[i].img" alt="@cateList[i].category_name"/>
                        <div class="carousel-caption">
                            <h4>@cateList[i].category_name</h4>
                            <p>@cateList[i].create_time.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")</p>
                        </div>
                    </div>
                }
            </div>

            <a class="left carousel-control" href="#carousel-cate-list" role="button" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left"></span>
                <span class="sr-only">Prev</span>
            </a>
            <a class="right carousel-control" href="#carousel-cate-list" role="button" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
        </div>
    </div>
}

<div style="height:10px;"></div>